package com.jk.dao;

import com.jk.entity.Product;
import com.jk.entity.ProductSeckill;
import com.jk.entity.Shoptype;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface ProductDao {

    @Select("SELECT * FROM t_product LIMIT 0,8")
    List<Product> getListPro();


    @Select("select * from t_product where product_id = #{id}")
    List<Product> getProOne(Integer id);

    @Select("select * from t_product where product_id = #{id}")
    Product getInfo(String id);

    @Select("select * from t_product")
    List<Product> getListPros();

    @Select("select * from t_product where product_id = #{carId}")
    Product getCarId(String carId);

    @Select("select * from instant_buy_item")
    List<ProductSeckill> seckill22();

    @Select("select * from instant_buy_item where  item_id= #{id}")
    List<ProductSeckill> seckillOne(String id);


    @Select("select * from instant_buy_item where  item_id= #{id}")
    ProductSeckill seckill(Integer id);

    @Update("update instant_buy_item  set number=number-1 where item_id= #{id}")
    void seckillUpdate(Integer id);

    @Select("select * from t_shop_type where sid = #{id}")
    List<Shoptype> getProOness(Integer id);

    @Select("select * from t_shop_type where id = #{id}")
    List<Shoptype> getTypeOne(Integer id);

    @Select("select * from t_product where tid = #{id}")
    List<Product> getPros1(Integer id);
}
